package com.taikang.hmp.hbusiness.diabetes.measure.job;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.taikang.hmp.frame.common.datastructre.Dto;
import com.taikang.hmp.frame.common.datastructre.support.BaseDto;
import com.taikang.hmp.frame.customer.bean.CustomerInfo;
import com.taikang.hmp.hbusiness.diabetes.measure.meal.service.IMealService;


/** 
 * 自动更新膳食标准服务
 * author:qrp
 * time:2015年8月14日 上午10:50:13
 */
public class InitMealStandardJob  {
	private static Logger logger = LoggerFactory.getLogger(InitMealStandardJob.class);


	private IMealService mealService;

	public IMealService getMealService() {
		return mealService;
	}

	public void setMealService(IMealService mealService) {
		this.mealService = mealService;
	}


	private void genMealStandard(){
		logger.info("自动更新膳食标准批处理启动......");
		//删除标准库信息，重新生成
		mealService.delAllStandardInfo();
		List<CustomerInfo> info = mealService.getAllCustomer();
		for (int i = 0; i > info.size(); i++) {
			try {
				Dto paramDto = new BaseDto();
				paramDto.put("customerid", info.get(i).getCustomer_id());
				paramDto.put("uid", info.get(i).getUser_id());
				mealService.initMealStandard2DB(paramDto);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
		logger.info("自动更新膳食标准批处理结束");
	}
}
